package com.example.nfcschool;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.TextView;

public class LoadingActivity extends Activity {
   TextView tv1;
   
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_loding);
      
   // ActionBar제거한다.
      ActionBar actionBar = getActionBar();
        actionBar.hide();
      
      Typeface typeFace = Typeface.createFromAsset(getAssets(), "white.ttf");
      tv1 = (TextView) findViewById(R.id.textView1);
      tv1.setTypeface(typeFace);
      
      
      
      LinearLayout ly = (LinearLayout)findViewById(R.id.LinearLayout1);
      Animation alpha = AnimationUtils.loadAnimation( this, R.anim.alpha2 );
      ly.startAnimation(alpha);
      
      Handler hd = new Handler();
      hd.postDelayed(new Runnable() {
            @Override
            public void run() {
               stopani();
            }
        }, 3000); // 2.5초 후 이미지를 닫습니다.
   }
   
   
   public void stopani(){
      finish();
      Intent intent = new Intent( this, MainActivity.class );
      intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
      startActivity(intent);
   }

   @Override
   public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
   }
   
   @Override
   public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
      return super.onOptionsItemSelected(item);
   }
}